<style>
    .nav-tabs{
        border-bottom: unset;
    }
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="row content" style="padding: 0px;">
        <div class="panel-group" id="accordion">
            <div class="panel panel-success">
                <div class="panel-heading">
                    <h4 class="panel-title">

                        <small style="margin-left: 10px;" class=" label bg-purple">总消费：{$row.purchase_total|htmlentities}</small>
                        <small style="margin-left: 10px;" class=" label bg-blue">下单：{$row.purchase_times|htmlentities}次</small></label>
                        <small style="margin-left: 10px;" class=" label bg-green">
                            {php}
                            $deal_time= \addons\facrm\library\Helper::timeTran($row['deal_time']);
                            echo  $deal_time?$deal_time.'下单':'无下单';
                            {/php}
                        </small></label>
                        <span class="label label-primary pull-right">
                            <a href="#" style="color: #ffffff" onclick="javascript:parent.Fast.api.open('facrm/customer/index/edit/ids/{$row.id|htmlentities}',__('修改客户信息-')+'{$row.name|htmlentities}');"> {:__('修改')}</a>
                        </span>

                    </h4>
                </div>
                <div id="collapseOne" class="panel-collapse collapse in">
                    <div class="panel-body">

                        <div class="form-group col-md-6 col-xs-12">
                            <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('客户名称')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-name"  style="border-right: unset" data-rule="required" type="text" class="form-control" name="row[name]" value="{$row.name|htmlentities}"  />
                                    <div class="input-group-addon " style="border-left: unset">
                                        <span>ID：{$row.id|htmlentities}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-xs-12">

                            <label for="c-telephone" class="control-label col-xs-12 col-sm-2">{:__('联系电话')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-telephone" class="form-control" size="50" name="row[telephone]" type="text" value="{$row.telephone|htmlentities}"  >
                                    <div class="input-group-addon no-border no-padding">
                                        <span>
                                            <button type="button"  class="btn btn-success cloudcall" data-type="customer" data-field="telephone" data-typeid="{$row.id|htmlentities}" data-name="{$row.name|htmlentities}"
                                            ><i class="fa fa-phone"></i> {:__('云呼')}</button></span>

                                    </div>
                                </div>
                            </div>


                        </div>

                        <div class="form-group col-md-6 col-xs-12">
                            <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('联系手机')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-mobile" class="form-control" size="50" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}"  >
                                    <div class="input-group-addon no-border no-padding">
                                        <span>
                                            <button type="button"  class="btn btn-success cloudcall" data-type="customer" data-field="mobile" data-typeid="{$row.id|htmlentities}" data-name="{$row.name|htmlentities}"
                                            ><i class="fa fa-phone"></i> {:__('云呼')}</button></span>

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-xs-12">
                            <label class="control-label col-xs-12 col-sm-2">{:__('客户级别')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                {:build_select('row[level]', $levelList,$row.level, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-xs-12">
                            <label class="control-label col-xs-12 col-sm-2">{:__('客户行业')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                {:build_select('row[industry]', $industryList, $row.industry, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-xs-12">
                            <label class="control-label col-xs-12 col-sm-2">{:__('客户来源')}:</label>
                            <div class="col-xs-12 col-sm-8">
                               {:build_select('row[source]', $sourceList, $row.source, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                                  
							</div>
                        </div>
                        <div class="form-group col-md-6 col-xs-12">
                            <label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('客户标签')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-tags" data-rule="" class="form-control" placeholder="输入后空格确认" name="row[tags]" type="text" value="{$row.tags|htmlentities}">
                                <span class="text-gray">输入后空格确认</span>
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-xs-12">
                            <label for="c-address" class="control-label col-xs-12 col-sm-2">地址:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area">
                                    <select class="province form-control" name="province" data-url="ajax/area">
                                        <option value="{$row.province|htmlentities}" selected=""></option>
                                    </select>
                                    <select class="city form-control" name="city" data-url="ajax/area">
                                        <option value="{$row.city|htmlentities}" selected=""></option>
                                    </select>
                                    <select class="area form-control" name="area" data-url="ajax/area">
                                        <option value="{$row.area|htmlentities}" selected=""></option>
                                    </select>
                                </div>
                            </div>
                            <small class="pull-left" style=" margin-left: -10px;line-height: 31px;">
                                <i class="fa fa-info-circle"></i> <a href="#" data-toggle="tooltip"  data-original-title="插件会用到fa_area表数据。您可以直接导入数据，或者后台安装“开发示例”插件">有问题?</a></small>

                        </div>

                        <div class="form-group col-md-6 col-xs-12">
                            <label for="c-detail_address" class="control-label col-xs-12 col-sm-2">详细地址:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-detail_address" type="text" class="form-control" name="row[detail_address]" value="{$row.detail_address|htmlentities}"  />
                            </div>
                        </div>

                        <div class="form-group col-md-6 col-xs-12">
                            <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <textarea id="c-remark" class="form-control" name="row[remark]">{$row.remark|htmlentities}</textarea>
                            </div>
                        </div>


                    </div>
                </div>
            </div>


            <div class="panel panel-info">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse"
                           href="#collapseThree">
                            {:__('资料扩展')}
                        </a>
                    </h4>
                </div>
                <div id="collapseThree" class="panel-collapse collapse in">
                    <div class="panel-body">
                        <div id="extend"></div>

                    </div>
                </div>
            </div>


        </div>



        <div class="panel panel-default panel-info">
            <div class="panel-heading" style="padding-bottom: 0;">
                <ul class="nav nav-tabs">

                    <li class="active"><a href="#bulletin" role="tab" data-toggle="tab">跟进记录</a></li>
                    {if($auth->check('facrm/customer/contacts/index'))}
                    <li><a href="#forum" role="tab" data-toggle="tab">联系人</a></li>
					{/if}
					{if($auth->check('facrm/business/index'))}
                    <li><a href="#business" role="tab"  data-toggle="tab">商机</a></li>
					{/if}
			
                    {if($auth->check('facrm/customer/index/contractlist'))}
                    <li><a href="#contract" role="tab"  data-toggle="tab">合同</a></li>
                    {/if}
                    {if($auth->check('facrm/customer/index/receivableslist'))}
                    <li><a href="#receivables" role="tab"  data-toggle="tab">收款</a></li>
                    {/if}
                    {if($auth->check('facrm/customer/record/files'))}
                    <li><a href="#files12" role="tab"  data-toggle="tab">附件</a></li>
                    {/if}
                    {if($auth->check('facrm/operatelog/index'))}
                    <li><a href="#" onclick="javascript:parent.Fast.api.open('facrm/operatelog/index/customer_id/{$row.id|htmlentities}',__('操作日志-')+'{$row.name|htmlentities}');" >{:__('日志')}</a></li>
                    {/if}
                    {if($auth->check('facrm/customer/record/calllog'))}
                    <li><a href="#" onclick="javascript:Fast.api.open('facrm/customer/record/calllog?customer_id={$row.id|htmlentities}',__('通话记录-')+'{$row.name|htmlentities}');" >{:__('通话记录')}</a></li>
                    {/if}

                </ul>


            </div>
            <div class="panel-body">
                <div id="myTabContent" class="tab-content">
                   

                    <!-- 跟进记录开始-->
                    <div class="tab-pane fade active in" id="bulletin">
						 <div id="toolbar1" class="toolbar ">
							<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
							{if($auth->check('facrm/customer/record/add'))}
							<a href="javascript:;" data-url="facrm/customer/record/add/ids/{:input('ids')}" class="btn btn-success  btn-dialog "
							   title="添加跟进"><i class="fa fa-plus"></i> 添加跟进</a>
							{/if}
						</div>
                        <table id="tableflow" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                    </div>
                    <!-- 跟进记录结束-->
					{if($auth->check('facrm/customer/contacts/index'))}
                    <!-- 联系人开始-->
                    <div class="tab-pane fade" id="forum">
						 <div id="toolbar2" class="toolbar ">
							<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
							{if($auth->check('facrm/customer/contacts/add'))}
							<a href="javascript:;" data-url="facrm/customer/contacts/add/customer_id/{:input('ids')}" class="btn btn-success  btn-dialog "
							   title="添加联系人"><i class="fa fa-plus"></i> {:__('添加')}</a>
							{/if}
						</div>
                        <table id="contact" class="table table-striped table-bordered table-hover table-nowrap" width="100%"
                               data-operate-edit1="{:$auth->check('facrm/customer/contacts/edit')}"
                               data-operate-del1="{:$auth->check('facrm/customer/contacts/del')}"
                        ></table>

                    </div>
                    <!-- 联系人结束-->
					{/if}
					{if($auth->check('facrm/business/index'))}
                    <!-- 商机开始-->
                    <div class="tab-pane fade" id="business">
						 <div id="toolbar-business" class="toolbar ">
                        <a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
                        {if($auth->check('facrm/business/index/add'))}
							<a href="javascript:;" data-url="facrm/business/index/add/customer_id/{:intval(input('ids'))}" class="btn btn-success  btn-dialog "
							   title="添加商机"><i class="fa fa-plus"></i> 添加</a>
							{/if}
						</div>
                        <table id="t-business" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                    </div>
                    <!-- 商机结束-->
					{/if}
                    {if($auth->check('facrm/customer/index/contractlist'))}
                    <!-- 合同开始-->
                    <div class="tab-pane fade" id="contract">
						
						<div id="toolbar-contract" class="toolbar ">
							<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
							{if($auth->check('facrm/contract/index/contractadd'))}
							<a href="javascript:;" data-url="facrm/contract/index/contractadd/customer_id/{:intval(input('ids'))}" class="btn btn-success  btn-dialog "
							   title="添加合同"><i class="fa fa-plus"></i> {:__('添加')}</a>
							{/if}
						</div>
                        <table id="t-contract" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                    </div>
                    <!-- 合同结束-->
                    {/if}
                    {if($auth->check('facrm/customer/index/receivableslist'))}
                    <!-- 收款开始-->
                    <div class="tab-pane fade" id="receivables">
	
						<div id="toolbar-receivables" class="toolbar ">
							<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
							{if($auth->check('facrm/contract/receivables/receivablesadd'))}
							<a href="javascript:;" data-url="facrm/contract/receivables/receivablesadd/customer_id/{:intval(input('ids'))}" class="btn btn-success  btn-dialog "
							   title="添加收款"><i class="fa fa-plus"></i> 添加</a>
							{/if}
						</div>
                        <table id="t-receivables" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                    </div>
                    <!-- 收款结束-->
                    {/if}
                    {if($auth->check('facrm/customer/record/files'))}
                    <!-- 附件-->
                    <div class="tab-pane fade" id="files12">
                        <table id="t-files" class="table table-striped table-bordered table-hover" width="100%"></table>
                    </div>
                    <!-- 附件-->
                    {/if}
                </div>
            </div>
        </div>


    </div>




					    
	{if !isset($action)}
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
    {/if}
</form>
<script>
    var customer_id={:input('ids')};
    var record_type_list={:json_encode($record_type_list)};
</script>




